document.addEventListener('DOMContentLoaded', function() {
    var image = document.getElementById('autoHideImage');
    var button = document.getElementById('hideButton');

    // 自动隐藏图片
    setTimeout(function() {
        image.style.height = '0';
        button.style.display = 'none';
    }, 5000);

    // 手动隐藏图片
    button.addEventListener('click', function() {
        image.style.height = '0';
        button.style.display = 'none';
    });
});
// 显示或隐藏回到顶部按钮
window.onscroll = function() {
    scrollFunction();
};

function scrollFunction() {
    var button = document.getElementById("backToTopButton");
    if (document.body.scrollTop > 20 || document.documentElement.scrollTop > 20) {
        button.style.display = "block";
    } else {
        button.style.display = "none";
    }
}

// 回到顶部的逻辑
function topFunction() {
    document.body.scrollTop = 0; // For Safari
    document.documentElement.scrollTop = 0; // For Chrome, Firefox, IE and Opera
}

// 为按钮添加点击事件
document.getElementById("backToTopButton").addEventListener("click", topFunction);